<!--
 * @Description:
 * @Version: 1.668
 * @Autor: 地虎降天龙
 * @Date: 2025-03-31 15:57:18
 * @LastEditors: 地虎降天龙
 * @LastEditTime: 2025-04-07 08:28:44
-->
<template>
  <el-button v-if="showButton" type="primary" size="small" @click="gogogogo()">发消息</el-button>
</template>
<script>
import { startQiankun } from '../../qiankuncom/init.js'

export default {
  name: 'Appmicro',
  components: {},
  props: {
    showButton: {
      type: Boolean,
      default: false
    }
  },
  data() {
    return {}
  },
  mounted() {
    startQiankun()
    // loadMicroApp({
    //   name: 'qiankun-child', // 子应用的名称
    //   entry: '//localhost:8081', // 子应用的域名
    //   container: '#Appmicro', // 承载子应用的容器，在上面App.vue中定义
    //   activeRule: '/vue-son', // 被激活的子应用的路由
    //   sandbox: {
    //     experimentalStyleIsolation: true
    //   }
    // })
  },
  methods: {

    gogogogo() {
      window?.qiankunActions?.setGlobalState({
        message: '主应用发送给子应用的消息'
      })
    }
  }
}
</script>

<style lang="scss" scoped></style>
